<template>
	<view class="mine-container">
		<!--顶部个人信息栏-->
		<view class="header-section">
			<view class="flex padding justify-between">
				<view class="flex align-center">
					<view v-if="!avatar" class="cu-avatar xl round bg-white">
						<view clas="iconfont icon-people text-gray icon"></view>
					</view>
					<image :src="avatar" class="cu-avatar xl round" mode="widthFix"></image>
					<view>
						<view class="user-info">
							<view class="u_title">
								{{ name }}
							</view>
						</view>
						<view class="user-info">{{areaName}}</view>
					</view>

				</view>
			</view>
		</view>

		<view class="menu-list">
			<view class="list-cell list-cell-arrow" @click="handleToPwd">
				<view class="menu-item-box">
					<view class="iconfont icon-password menu-icon"></view>
					<view>修改密码</view>
				</view>
			</view>
			<view class="list-cell list-cell-arrow" @click="handleAbout">
				<view class="menu-item-box">
					<view class="iconfont icon-aixin menu-icon"></view>
					<view>关于</view>
				</view>
			</view>
		</view>
		<view class="cu-list menu">
			<view class="cu-item item-box">
				<view class="content text-center" @click="handleLogout">
					<text class="text-black">退出登录</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {}
		},
		computed: {
			avatar() {
				return this.$store.state.user.avatar
			},
			name() {
				return this.$store.state.user.name
			},
			areaName() {
				return this.$store.state.user.areaName
			},
			windowHeight() {
				return uni.getSystemInfoSync().windowHeight - 50
			}
		},
		methods: {
			handleToLogin() {
				this.$tab.reLaunch('/pages/login')
			},
			handleLogout() {
				this.$modal.confirm('确定注销并退出系统吗？').then(() => {
					this.$store.dispatch('LogOut').then(() => {
						this.$tab.reLaunch('/pages/login')
					})
				})
			},
			// 关于共用
			handleAbout() {
				this.$tab.navigateTo('/pages/mine/about/index')
			},
			// 修改密码参数不同,不共用
			handleToPwd() {
				this.$tab.navigateTo('/pages/school-mine/pwd/index')
			},
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f5f6f7;
	}

	.mine-container {
		width: 100%;
		height: 100%;


		.header-section {
			padding: 15px 15px 20px 15px;
			background-color: #3c96f3;
			color: white;

			.login-tip {
				font-size: 18px;
				margin-left: 10px;
			}

			.cu-avatar {
				border: 2px solid #eaeaea;

				.icon {
					font-size: 40px;
				}
			}

			.user-info {
				margin-left: 15px;

				.u_title {
					font-size: 16px;
					line-height: 30px;
				}
			}
		}

		.content-section {
			position: relative;
			top: -50px;

			.mine-actions {
				margin: 15px 15px;
				padding: 20px 0px;
				border-radius: 8px;
				background-color: white;

				.action-item {
					.icon {
						font-size: 28px;
					}

					.text {
						display: block;
						font-size: 13px;
						margin: 8px 0px;
					}
				}
			}
		}
	}
</style>